package com.example.lx6_8

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.example.base.aa.mvvm.BaseActivity
import com.example.lx6_8.adapter.AttendAdapter
import com.example.lx6_8.attend.AttendViewModel
import com.example.lx6_8.databinding.ActivityMainBinding
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch

@AndroidEntryPoint
@Route(path = "/app/MainActivity")
class MainActivity : BaseActivity<ActivityMainBinding,AttendViewModel>() {

    val attendAdapter by lazy { AttendAdapter() }
    override fun initView() {
        binding.rv.apply {
            adapter = attendAdapter
            layoutManager = LinearLayoutManager(this@MainActivity)
        }
        lifecycleScope.launch {
            vm.getAttend().collect{
                attendAdapter.submitData(it)
            }
        }
    }

    override fun initData() {

    }

}